package com.dd.config;

import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;

/**
 * ProjectName: springMvc01->MybatisConfig
 * Description: TODO：
 * Author: 丘丘
 * DateTime: 2024/12/27 08:27
 */
@Component
@MapperScan("com.dd.mapper")
public class MybatisConfig {
    // 生成SSFB对象
    @Bean
    public SqlSessionFactoryBean sqlSessionFactoryBean(DataSource dataSource){
        SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
        factoryBean.setDataSource(dataSource);
        return factoryBean;
    }



}
